This study will evaluate the mechanism of action od thalidomide to selectively inhibit release of tumor necrosis factor (TNF) in patients with tuberculosis and/or HIV infection. It will assess the safety and efficacy of thalidomide, as judged by symptoms, physical examination, and studies of microbiological, immunologic, hematological, renal, and hepatic status.